﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.ObjectModel;

namespace Obsidian.GameObjects
{
    public class GameObjectCollection : List<GameObject>
    {
        internal GameObjectCollection(GameObject parent) { _parent = parent; }

        public new void Clear()
        {
            foreach (var s in this)
                s.Parent = null;
            base.Clear();
        }

        public new void Add(GameObject item)
        {
            item.Parent = _parent;
            base.Add(item);
        }

        public new void Remove(GameObject item)
        {
            item.Parent = null;
            base.Remove(item);
        }

        GameObject _parent;
    }
}
